<template>
  <div class="tab">
    <ul class="title">
      <li v-for=" (item,index) in tab.title" :key="index" @click="tabClick(index)" :class="{active:active==index}">
        {{item}}
      </li>
    </ul>

    <div class="tabContent">
      <div v-for="(itemContent,index) in tab.content" :key="index" v-show="index==num">
        {{itemContent}}
      </div>
    </div>

  </div>
</template>

<script>
export default {
  name: "tab",
  data() {
    return {
      num: "0",
      active:"0"
    };
  },
  props: ["tab"],
  created() {
    console.log("nav:", this.nav);
  },
  methods: {
    tabClick(index) {
      this.num = index;
      this.active = index;
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
@import "./tab.scss";
</style>
